import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:search_people/page/home/main/logic.dart';
import 'package:search_people/utils/component/component.dart';
import 'package:search_people/utils/img_util.dart';
import 'package:search_people/value/topcolors.dart';

class HomeMenu extends StatelessWidget {
  HomeMenu({Key? key}) : super(key: key);
  final controller = Get.find<HomeLogic>();
  final state = Get.find<HomeLogic>().state;
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      key: state.intro.keys[1],
      padding: EdgeInsets.symmetric(vertical: 20.r),
      child: Wrap(
        runSpacing: 20.r,
        children: state.menuItems
            .asMap()
            .map((key, value) => MapEntry(
                key,
                MenuItemView(
                    onTap: value.onTap,
                    width: Get.width / 4,
                    icon: Image.asset(
                      value.icon.imgPathHome,
                      width: 40.r,
                      height: 40.r,
                    ),
                    title: Text(
                      value.title,
                      style: TextStyle(
                        color: TopColors.black_33,
                        fontSize: 12.sp,
                      ),
                    ))))
            .values
            .toList(),
      ),
    );
  }
}
